
const Base_URL = "https://tea.qingnian8.com/api/bizhi/"


export function request(config = {}){
	let { 
		url,
		method = "GET",
	    header = {},
		data = {}
		} = config
	url = Base_URL + url
	header['access-key'] = "564926"
	//header['token'] = "123123123123"
	return new Promise((resolve,reject)=>{
		uni.request({
			url, 
			method,
			header,
			data,
			// header: {
			// 	"access-key" : "725531"
			// },
			// data: {
			// 	"select":param.select,
			// 	"pageNum": param.pageNum,
			// 	"pageSize": "9",
			// }
			success: (e) => {
				if (e.data.errCode === 0) {
					resolve(e)
				} else if (e.data.errCode == 400) {
					uni.showModal({
						title:"错误提示",
						content:e.data.errMsg,
						showCancel:false
					})
					reject(e.data)
				} else {
					uni.showToast({
						title:e.data.errMsg,
						icon:"none"
					})
					reject(e.data)
				}
				
			},
			fail: (e) => {
				reject(e)
			}
		})
	})
	
}